#include<stdio.h>  
#include<math.h>  

//函数havesamenum确认num是否满足条件  

int havesamenum(int num)  
{  
	int i=0,j;  
	char a[10] = {0};  

	while(num>0)  
	{  
		j = num % 10;  
		a[j] += 1;  
		num = num / 10;  
	}
	
	while(a[i] <= 1 && i < 10)  
		i++;  

	if (i < 10)   
		return 1;  
	else   
		return 0;  
}  

void test_sqrt(void)
{
	printf("sqrt = %f\n", sqrt(4));	// 2.00000
}

void rand_sqrt()
{
	double x;
	double n = rand() % 100;

	printf("%lf\n",n);

	x=sqrt(n);

	printf("%lf\n",x);
}

void main(void)  
{  
	int i,j,m;  

	test_sqrt();
	rand_sqrt();


	/* double sqrt(double x) */

	m=(int)sqrt(99999);  
	printf("sqrt = %d\n", m);	// 316   316 * 316 = 99856

	for( i= 1; i < m; i++)  
	{  
		j = i * i;  

		if (1 == havesamenum(j))   
			printf("%6d\t",j);  
	}  
}  
